//
//  PokerMenu.h
//  CPokerMenu: Main class of the game
//
//  Created by Enric Vergara on 20.10.12. 
//  Copyright OWLAB 2010. All rights reserved.
// Import the interfaces

#import "PokerMenu.h"



// CExitMenu implementation
@implementation CPokerMenu



// on "init" you need to initialize your instance
-(id) init
{
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super" return value
	if ((self = [super init]))
    {
                
        m_Sprite_CardLeft_Reverse= [CCSprite spriteWithFile:@"reverso.png"]; 
        m_Sprite_CardLeft_Reverse.visible = true;
        [m_Sprite_CardLeft_Reverse setPosition:CGPointMake(-CARD_OFFSET_POSX, 0)];
        [super addChild:m_Sprite_CardLeft_Reverse z:0 tag:0];
        
        m_Sprite_CardRight_Reverse = [CCSprite spriteWithFile:@"reverso.png"];
        m_Sprite_CardRight_Reverse.visible = true;
        [m_Sprite_CardRight_Reverse setPosition:CGPointMake(CARD_OFFSET_POSX, 0)];
        [super addChild:m_Sprite_CardRight_Reverse z:0 tag:1];

        
		// must be enabled if you want to receive touch events!
		self.isTouchEnabled = YES;
	}
	return self;
}

- (void) setHoleCards:(unsigned int)right LeftCard:(unsigned int) left
{
    NSString * fileSprites = [NSString stringWithFormat:@"%i.png", left];
    m_Sprite_CardLeft = [CCSprite spriteWithFile:fileSprites]; 
    [m_Sprite_CardLeft setPosition:CGPointMake(-CARD_OFFSET_POSX, 0)];
    m_Sprite_CardLeft.visible = false;
    [super addChild:m_Sprite_CardLeft z:0 tag:LEFT_CARD];
    
    fileSprites = [NSString stringWithFormat:@"%i.png", right];
    m_Sprite_CardRight = [CCSprite spriteWithFile:fileSprites];
    m_Sprite_CardRight.visible = false;
    [m_Sprite_CardRight setPosition:CGPointMake(CARD_OFFSET_POSX, 0)];
    [super addChild:m_Sprite_CardRight z:1 tag:RIGHT_CARD];
    
    m_Sprite_CardRight_Reverse.visible = true;
    m_Sprite_CardLeft_Reverse.visible = true;
    
}

- (void) showCards
{
    m_Sprite_CardLeft.visible = true;
    m_Sprite_CardRight.visible = true;
    m_Sprite_CardLeft_Reverse.visible = false;
    m_Sprite_CardRight_Reverse.visible = false;
}

- (void) hideCards
{
    m_Sprite_CardLeft.visible = false;
    m_Sprite_CardRight.visible = false;
    m_Sprite_CardLeft_Reverse.visible = true;
    m_Sprite_CardRight_Reverse.visible = true;
}

- (void) resetStatus
{
    [super removeChildByTag:LEFT_CARD cleanup:true];
    [super removeChildByTag:RIGHT_CARD cleanup:true];
    
    m_Sprite_CardRight_Reverse.opacity = 255;
    m_Sprite_CardLeft_Reverse.opacity = 255;
    m_Sprite_CardRight_Reverse.visible = false;
    m_Sprite_CardLeft_Reverse.visible = false;
}


-(void) ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
    
}

-(void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    
}



// on "dealloc" you need to release all your retained objects
-(void) dealloc
{
	// don't forget to call "super dealloc"
	[super dealloc];
}

@end
